package com.itheima.mall.service.pmsService;


import com.itheima.mall.commons.R;
import com.itheima.pojo.pms.PmsSkuStock;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class PmsSkuStockService {
    @DubboReference
    private PmsSkuStockApi pmsSkuStockApi;

    public R updateSku(Long pid, List<PmsSkuStock> skuStockList) {
        for (PmsSkuStock pmsSkuStock : skuStockList) {
            pmsSkuStockApi.updateSku(pid,pmsSkuStock);
        }
        return R.ok(null);

    }

    public R searchSku(Long pid, String keyword) {
        //根据id和keyword获得sku库存
        List<PmsSkuStock> pssList = pmsSkuStockApi.searchSku(pid,keyword);
        return R.ok(pssList);
    }
}
